//
//  SRTimeService.m
//  SportRing
//
//  Created by mykoma on 14/10/28.
//  Copyright (c) 2014年 HotOne. All rights reserved.
//

#import "SRTimeService.h"
#import "BlueToothLib.h"

@implementation SRTimeService

+ (RACSignal *)updateCurrentTimeToDevie
{
    RACSubject * subject = [RACSubject subject];
    
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat: @"yyyy-MM-dd HH:mm:ss"];
    NSDate * baseDate = [dateFormatter dateFromString:@"2000-01-01 00:00:00"];
    
    [BlueToothLib synchronizationTimeNew:[[NSDate date] timeIntervalSinceDate:baseDate]
                               withBlock:^(BOOL isTimeOut)
     {
         [subject sendNext:nil];
     }];
    return subject;
}

@end
